package com.leancloud.circle.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.aries.ui.view.title.TitleBarView;
import com.flyco.tablayout.SegmentTabLayout;
import com.leancloud.circle.R;

import java.util.ArrayList;

import tech.com.commoncore.base.BaseTitleFragment;
import tech.com.commoncore.manager.TabLayoutManager;

/**
 * 圈子模块架子
 */
public class CircleShelfFragment extends BaseTitleFragment implements View.OnClickListener {

    private SegmentTabLayout segmentTabLayout;
    private ViewPager viewPager;

    private String[] tabTitle = {"币圈", "专栏"};

    public static CircleShelfFragment newInstance() {
        CircleShelfFragment fragment = new CircleShelfFragment();
        return fragment;
    }

    @Override
    public void setTitleBar(TitleBarView titleBar) {
        titleBar
                .setLeftTextDrawable(null)
                .setTitleMainText("社区").setBackground(getResources().getDrawable(R.drawable.bg_titlebar_jb));
    }

    @Override
    public int getContentLayout() {
        return R.layout.fragment_circle_shelf;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        segmentTabLayout = mContentView.findViewById(R.id.segment_tab_layout);
        viewPager = mContentView.findViewById(R.id.view_pager);

        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(CircleFragment.newInstance());
//        fragments.add(CurrencyArticleFragment.newInstance("4"));
        TabLayoutManager.getInstance().setSegmentTabData(this, segmentTabLayout, viewPager, tabTitle, fragments);
    }

    @Override
    public void onClick(View v) {

    }

}
